{__NOLAYOUT__}
<html>

<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="__SITE__/static/admin/css/base.css" />
    <link rel="stylesheet" href="__SITE__/static/admin/css/dialog.css" />
</head>

<body>


<div class="container edit-dialog fill-all flex v-center h-center" style="background-image: url(__SITE__/static/admin/img/big-bg.png);background-repeat:no-repeat;background-size:100% 100%;">

    <div class="corner-white">
        <div class="dialogs-title">
            登录
        </div>
        <div class="flex-1">
            <div>
                <div>手机号</div>
                <div>
                    <input class="inputs" type="text" value="" id="phone" placeholder="请输入手机号"/>
                </div>
            </div>

            <div>
                <div>密码</div>
                <div>
                    <input class="inputs" type="password" value="" id="pwd" placeholder="请输入密码" />
                </div>
            </div>


        </div>

        <div class="btn-container flex">

            <div class="flex-1 flex h-center v-center" id="true">
                <a href="javascript:;" class="btn-class btn-blue flex h-center v-center">
                    登录
                </a>
            </div>

        </div>

    </div>

</div>

<script type="text/javascript" src="__SITE__/static/admin/js/jquery-2.1.0.js" ></script>
<script>
</script>
</body>
<script>
    $(function () {
        $("#true").click(function () {

            if(checkphone() && checkpassword()) {
                var user_name = $("#phone").val();
                var password = $("#pwd").val();
                $.ajax({
                    url:"__SITE__/admin/Login/login",
                    data:{
                        user_name:user_name,
                        password:password
                    },
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            window.location.href = '__SITE__/admin/Index/index';
                        }else {
                            alert(data.msg);
                        }
                    }
                });
            }
        });

        //验证手机号格式
            function checkphone()
            {
                var tmp = $("#phone").val();
                if(!tmp) {
                    $("#phone").css('border','1px solid red');
                    return false;
                }
                var tag = /^1[34578]\d{9}$/;
                if(!tag.test($("#phone").val())) {
                    $("#phone").css('border','1px solid red');
                    return false;
                }
                $("#phone").css('border','1px solid #A9A9A9');
                return true;
            }

        $("#phone").blur(function () {
            checkphone();
        });

        //验证密码
        function checkpassword()
        {
            var pwd = $("#pwd").val();
            if(!pwd) {
                $("#pwd").css('border','1px solid red');
                return false;
            }else {
                $("#pwd").css('border','1px solid #A9A9A9');
                return true;
            }
        }
    })
</script>
</html>